package com.tjetc.controller;

import com.tjetc.pojo.dto.HotelDTO;
import com.tjetc.service.HotelService;
import com.tjetc.service.RoomService;
import com.tjetc.service.impl.HotelServiceImpl;
import com.tjetc.service.impl.RoomServiceImpl;
import com.tjetc.view.HotelCRUDPage;
import com.tjetc.view.InfoPage;
import com.tjetc.view.RoomCRUDPage;
import com.tjetc.view.impl.HotelCRUDPageImpl;
import com.tjetc.view.impl.InfoPageImpl;
import com.tjetc.view.impl.RoomCRUDPageImpl;

/**
 * @Author: itda
 * @Date: 2024/5/10 15:50
 * @Description: 酒店控制层
 */
public class HotelController {

    private HotelService hotelService = new HotelServiceImpl();

    private HotelCRUDPage hotelCRUDPage = new HotelCRUDPageImpl();

    private RoomService roomService = new RoomServiceImpl();

    private RoomCRUDPage roomCRUDPage = new RoomCRUDPageImpl();

    private InfoPage infoPage = new InfoPageImpl();


    public void info() {
        try {
            switch (infoPage.showHotel()) {
                case 1:
                    hotelService.save(hotelCRUDPage.save());
                    break;
                case 2:
                    hotelService.delete(hotelCRUDPage.delete());
                    break;
                case 3:
                    hotelService.update(hotelCRUDPage.update());
                    break;
                case 4:
                    hotelService.list();
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    public void room() {
        try {
            switch (infoPage.showRoom()) {
                case 1:
                    roomService.save(roomCRUDPage.save());
                    break;
                case 2:
                    roomService.delete(roomCRUDPage.delete());
                    break;
                case 3:
                    roomService.update(roomCRUDPage.update());
                    break;
                case 4:
                    roomService.list();
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
